Draft Rotate |
Menu location |
---|
Modification → Rotate Modify → Rotate |
Workbenches |
Draft, BIM |
Default shortcut |
R O |
Introduced in version |
0.7 |
See also |
Draft SubelementHighlight |
The Draft Rotate command rotates or copies selected objects around a center point by a given angle. The axis of rotation is perpendicular to the current working plane and the rotation angle is relative to that plane. In subelement mode the command rotates selected points and edges, or copies selected edges, of Draft Lines and Draft Wires.
The command can be used on 2D objects created with the Draft Workbench or Sketcher Workbench, but also on many 3D objects such as those created with the Part Workbench, PartDesign Workbench or BIM Workbench.
Rotating an object around a center point
See also: Draft Snap and Draft Constrain.
The single character keyboard shortcuts available in the task panel can be changed. See Draft Preferences. The shortcuts mentioned here are the default shortcuts (for version 1.0).
See also: Preferences Editor and Draft Preferences.
See also: Autogenerated API documentation and FreeCAD Scripting Basics.
To rotate objects use the rotate
method of the Draft module.
rotated_list = rotate(objectslist, angle, center=Vector(0,0,0), axis=Vector(0,0,1), copy=False)
objectslist
contains the objects to be rotated. It is either a single object or a list of objects.angle
is the angle of rotation in degrees.center
is the center point of rotation.axis
is the direction of the axis of rotation.copy
is True
copies are created instead of rotating the original objects.rotated_list
is returned with the original rotated objects, or with the new copies. It is either a single object or a list of objects, depending on objectlist
.Example:
import FreeCAD as App
import Draft
doc = App.newDocument()
polygon1 = Draft.make_polygon(3, radius=300)
Draft.move(polygon1, App.Vector(1000, 0, 0))
# Rotation around the origin
angle1 = 45
rot2 = Draft.rotate(polygon1, angle1, copy=True)
rot3 = Draft.rotate(polygon1, 2*angle1, copy=True)
rot4 = Draft.rotate(polygon1, 4*angle1, copy=True)
polygon2 = Draft.make_polygon(3, radius=1000)
polygon3 = Draft.make_polygon(5, radius=500)
Draft.move(polygon2, App.Vector(2000, 0, 0))
Draft.move(polygon3, App.Vector(2000, 0, 0))
# Rotation around another point
angle2 = 60
cen = App.Vector(3100, 0, 0)
list2 = [polygon2, polygon3]
rot_list2 = Draft.rotate(list2, angle2, center=cen, copy=True)
rot_list3 = Draft.rotate(list2, 2*angle2, center=cen, copy=True)
rot_list4 = Draft.rotate(list2, 4*angle2, center=cen, copy=True)
doc.recompute()